$(function(){
	$("#zhuanfa_submit").live('click',function(){
		var tClick = $(this);
		/*获取微博id*/
		var weiboId = $(this).prevAll("#weibo_id").text();
		/*获取转发内容*/
		var tContent = $(this).prevAll("#zhuanfa_info").val();
		/*如果转发内容为空，则返回；后则提交*/
		if (!tContent)	{
			return false;
		}
		else {
			$.ajax({
				type: "POST",
				url: "php_ajax/transpond.php",
				dataType: "html",
				cache: "false",
				data: {t_content: tContent, w_id: weiboId},
				success: function(){
					tClick.prevAll("#zhuanfa_info").val("");
					tClick.parents("#zhuanfa_box").hide();
					tClick.parents("#zhuanfa_box").next("#transpond_face").hide();
					$("#mask").toggle();
					refresh(weiboId,tClick);
					recount(tClick.prevAll(".zhuanfa_tips").find("#counter"),tClick,tClick.prev("#zhuanfa_info")); 
					alert("转发成功");
				}
			});
		}
	});
	function refresh(weiboId,tClick){
		/*刷新转发数*/
		$.ajax({
			type: "POST",
			url: "php_ajax/load_transpond_num.php",
			dataType: "html",
			cache: false,
			data: {w_id: weiboId},
			success: function(data){
				tClick.parents("#zhuanfa_box").prevAll(".weibo_button").find("a:contains('转发')").empty().html("转发("+data+")");
				if(tClick.parents("#zhuanfa_box").prevAll(".hot_img").find(".hot_img2").text() == "转发"){
					tClick.parents("#zhuanfa_box").prevAll(".hot_img").find(".hot_img1").empty().html(data);
				}
			}
		});
	}
});